package com.cmc.cloud.cmclink.doc.api.document.req.so;

import com.cmc.cloud.cmclink.doc.constant.SoCreate;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;

import static com.cmes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

/**
 * 订舱主 Base VO，提供给添加、修改、详细的子 VO 使用
 * 如果子 VO 存在差异的字段，请不要添加到这里，影响 Swagger 文档生成
 *
 * @author codegen
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SoBaseUpdateDto {

    @Schema(description = "客户参考号")
    @Length(max = 50, message = "客户参考号支持最大长度{max}")
    private String referenceNo;

    @Schema(description = "订舱船名 line 第一段", requiredMode = Schema.RequiredMode.REQUIRED)
    @Length(max = 50, message = "订舱船名 line 第一段支持最大长度{max}")
    private String bookingVessel;

    @Schema(description = "订舱航次 line 第一段", requiredMode = Schema.RequiredMode.REQUIRED)
    @Length(max = 50, message = "订舱航次 line 第一段支持最大长度{max}")
    private String bookingVoyage;

    @Schema(description = "route Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "18841")
    @NotNull(message = "route Id不能为空")
    private Long routeId;

    @Schema(description = "路径描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
    @Length(max = 255, message = "路径描述支持最大长度{max}")
    private String routeDescription;

    @Schema(description = "第一个liner段的POL设置为current pol")
    @Length(max = 5, message = "当前港口支持最大长度{max}")
    private String currentPort;

    @Schema(description = "接货地", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "接货地不能为空")
    @Length(max = 5, message = "接货地支持最大长度{max}")
    private String porCode;

    @Schema(description = "装货港", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "装货港不能为空")
    @Length(max = 5, message = "装货港支持最大长度{max}")
    private String polCode;

    @Schema(description = "卸货港", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "卸货港不能为空")
    @Length(max = 5, message = "卸货港支持最大长度{max}")
    private String podCode;

    @Schema(description = "目的地", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "目的地不能为空")
    @Length(max = 5, message = "目的地支持最大长度{max}")
    private String delCode;

    @Schema(description = "订舱人代码", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "订舱人代码不能为空")
    @Length(max = 50, message = "订舱人代码支持最大长度{max}")
    private String bookingParty;

    @Schema(description = "一级代理代码")
    @Length(max = 50, message = "一级代理代码支持最大长度{max}")
    private String topAgent;

    @Schema(description = "箱状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
    @NotBlank(groups = {SoCreate.class}, message = "箱状态不能为空")
    @Length(max = 1, message = "箱状态支持最大长度{max}")
    private String cntrStatus;

    @Schema(description = "箱主代码", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(groups = {SoCreate.class}, message = "箱主代码不能为空")
    @Length(max = 5, message = "箱主代码支持最大长度{max}")
    private String cntrOwner;

    @Schema(description = "舱位代码", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "舱位代码不能为空")
    @Length(max = 5, message = "舱位代码支持最大长度{max}")
    private String spaceOwner;

    @Schema(description = "约号", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "约号不能为空")
    @Length(max = 32, message = "约号支持最大长度{max}")
    private String agreementNo;

    @Schema(description = "运输条款", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "运输条款不能为空")
    @Length(max = 5, message = "运输条款支持最大长度{max}")
    private String shippingTerm;

    @Schema(description = "so 通知邮箱 多个")
    @Length(max = 500, message = "SO通知邮箱支持最大长度{max}")
    private String soNotifyEmails;

    @Schema(description = "si 通知邮箱 多个")
    @Length(max = 500, message = "SI通知邮箱支持最大长度{max}")
    private String siNotifyEmails;

    @Schema(description = "订舱时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date bookingTime;

    @Schema(description = "订舱备注", example = "你说的对")
    @Length(max = 500, message = "订舱备注支持最大长度{max}")
    private String bookingRemark;

    @Schema(description = "数据来源",example = "网厅:WEB,电子单据:EDI,应用程序接口:API,手动:MANUAL")
    @NotBlank(message = "数据来源不允许为空")
    private String dataSource;

    @Schema(description = "创建人id")
    @NotBlank(message = "创建人不允许为空")
    private String creator;
}
